The RHQ Server, at its core, is a JEE application. It has two main deployment units - the main EAR and an Installer WAR - and they are deployed inside a JBoss Application Server (currently on JBossAS version 4.2.3, but soon to be 7.x). The main EAR contains the full server-side business logic (all the EJBs, JPA entities, web GUI, etc). The Installer WAR is technically only needed one time when the RHQ Server is run the very first time after the RHQ Server distribution is unzipped onto the filesystem. The EAR should not be deployed until after the Installer WAR has finished its work.
Why an Installer WAR in addition to the main EAR?
Consider that out-of-box, we don't know certain environmental settings the user wants to use. The main example to look at is the type of database being used. RHQ supports both Postgres and Oracle for its backend database. However, we don't know what the user wants to use hence we don't know what configuration settings should be used for RHQ's app server datasource (for example: What's the JDBC URL? What's the username/password for the database? Should it be using the Postgres or Oracle JDBC driver?). Therefore, out-of-box, we don't have RHQ's datasource even defined yet.
Also, for new installations, the user's database won't have the RHQ schema - e.g. it won't have the necessary tables that RHQ needs. If the installation is an upgrade from a previous RHQ version, the schema may exist in the database, but it may be old and would thus need to be upgraded.
Other minor issues are things like: What port does the user want the web GUI to listen to? What's the SMTP hostname to be used by RHQ when it needs to send emails?
This is where the Installer WAR comes in. Out-of-box, RHQ Server's Installer WAR will be deployed/enabled but the main EAR is not enabled. The main EAR cannot be deployed yet because it will fail immediately (e.g. the JPA initialization will fail because the datasource has not be created yet and the database itself may not even have the RHQ tables yet). When the user points her browser to the RHQ Server, the Installer GUI will be displayed. The user will be able to fill in the form specifying things like the database type, JDBC URL, SMTP hostname, etc. Once the answers are supplied to the questions in the Installer's form, the user will click the "Install" button and server code running in the Installer WAR will perform all the necessary work to setup the application server for use by RHQ. This includes things like telling the app server to create a datasource for the appropriate database, setting up the email service with the appropriate SMTP hostname, running database schema creation/upgrade tasks to create the necessary tables in the database, etc.
RHQ's Installer WAR can be run in "auto-install" mode. This means if the rhq-server.properties file (which is nothing more than a file of system properties passed into the app server via the -P option) is fully configured already, the Installer WAR will detect this and automatically do the same things as if the user pressed the "Install" button. Because all settings are defined in rhq-server.properties, the Installer WAR can perform the install without user intervention. So technically we could decide to not provide the user with a Installer GUI at all, but these tasks performed by the Installer WAR will still need to be performed regardless.
Once the Installer WAR completes all the install tasks, it will then immediately deploy the main EAR. It will also attempt to undeploy itself since it is no longer needed - the installation tasks are done and the Installer WAR has nothing else to do for the life of that RHQ Server. At this point in time, the main EAR can now successfully start up because things like the datasource and email service are already created and fully configured and the database now has the proper RHQ schema. The main EAR, once finished initialization, can now serve up the main RHQ GUI and we now have a fully functional RHQ Server.